package com.cmy.config;

import com.cmy.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

//@Configuration 本质上还是@Compontent,也会被注册到Spring容器中
//@Configuration 还表示这是一个配置类==beans.xml
@Configuration
@ComponentScan("com.cmy.pojo")
@Import(HisConfig.class)
public class MyConfig {

    //注册一个bean,=<bean id="" class = "" .../>
    //而方法名:getUser相当于id
    //方法返回值:User 相当于class
    @Bean
    public User user(){
        return new User();//返回要注入到bean的对象
    }
}

    